<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Model\Admin\SystemMenuModel;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class IndexController extends Controller
{
    //
    public function index()
    {
        return view('admin.index.index');
    }

    /**
     * 初始化系统
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function getSystemInit()
    {
        $home_info = [
            'title' => '首页',
            'href'  => 'welcome',
        ];
        $logo_info = [
            'title' => '网站管理',
            'image' => 'images/logo.png',
        ];
        // 获取菜单列表
        $Menu = new MenuController();

        $select = ['id','href','pid','title','icon','target'];
        $menu_info = $Menu->getMenuList($select);
        $system_init = [
            'homeInfo' => $home_info,
            'logoInfo' => $logo_info,
            'menuInfo' => $menu_info,
        ];

        return response()->json($system_init);
    }

    public function welcome()
    {
        return view('admin.welcome');
    }
}
